package binaryTree;

import utils.binaryTreeUtil.TreeNode;

public class invertTree {
    public TreeNode invertTree(TreeNode root) {
        invert(root);
        return root;
    }
    public void invert(TreeNode root){
        if (root==null) {
            return;
        }
        //交换位置
        TreeNode temp =root.left;
        root.left=root.right;
        root.right=temp;
        invert(root.left);
        invert(root.right);
    }

    public static void main(String[] args) {
        
    }
}
